Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

307
Views
SpringBoot MongoDB devuelve "Id debe ser asignable a Serializable! El objeto de clase [null] debe ser una instancia de la interfaz java.io.Serializable"

Intenté agregar una nueva colección a mi API/DB hoy, y cuando intento POST u GET, obtengo esta respuesta de error 500:

 { "cause": null, "message": "Id must be assignable to Serializable! Object of class [null] must be an instance of interface java.io.Serializable" }

Sin embargo, el POST es realmente exitoso, puedo ver los nuevos datos en la base de datos.

modelo :

 @Setter @Getter public class League { private String name; private String shortName; private List<Team> teams; }

Repositorio :

 @RepositoryRestResource(collectionResourceRel = "leagues", path = "leagues", excerptProjection = LeagueProjection.class) public interface LeagueRepository extends MongoRepository<League, String> { }

Proyección :

 @Projection(name="LeagueProjection", types={League.class}) public interface LeagueProjection { String getName(); String getShortName(); }

No estoy haciendo nada especial. Tengo muchas otras colecciones que funcionan bien.

Estoy usando spring-boot 1.5.1.

¡Gracias!

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Agregando el campo:

 @Id private String id;

a mi modelo parece haber resuelto el problema.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!